/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package penerimabeasiswa;

/**
 * mendiskripsikan IPK mahasiswa
 * himpunan: buruk, cukup bagus
 * @author fendi
 */
public class IPK {
    private double ipk;

    public IPK(double ipk) {
        this.ipk = ipk;
    }

    public double getIpk() {
        return ipk;
    }

    public void setIpk(double ipk) {
        this.ipk = ipk;
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanBuruk(){
        if(ipk<=2){
            return 1;
        }else if(ipk>=2 && ipk<=2.75){
            return ((ipk-2)/(0.75));
        }else {
            return 0;
        }
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanCukup(){
        if(ipk>=2 && ipk<=2.75){
            return ((ipk-2)/(0.75));
        }else if(ipk>=2.75 && ipk<=3.25){
            return ((3.25-ipk)/(0.5));
        }else {
            return 0;
        }
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanBagus(){
        if(ipk<=2.75){
            return 0;
        }else if(ipk>=2.75 && ipk<=3.25){
            return ((ipk-2.75)/(0.5));
        }else {
            return 1;
        }
    }
}
